    jQuery('#ptm').combogrid({
    panelWidth:700,
    url: URL+'/filter_product/type/tm',
    idField:'id',
    textField:'name',
    mode:'remote',
    fitColumns:true,
    columns:[[
        {field:'id',title:'产品编号',width:40},
        {field:'tm',title:'条码',align:'left',width:80},
        {field:'name',title:'名称',align:'left',width:500},
        {field:'unit_id',title:'单位',align:'right',width:30},
        {field:'cost_default',title:'默认进价',align:'left',width:40}
    ]]
});

jQuery('#ppy').combogrid({
    panelWidth:700,
    url: URL+'/filter_product/type/helpword',
    idField:'id',
    textField:'name',
    mode:'remote',
    fitColumns:true,
    columns:[[
        {field:'id',title:'产品编号',width:40},
        {field:'tm',title:'条码',align:'left',width:80},
        {field:'name',title:'名称',align:'left',width:500},
        {field:'unit_id',title:'单位',align:'right',width:30},
        {field:'cost_default',title:'默认进价',align:'left',width:40}
    ]]
});

jQuery('#hanzi').combogrid({
    panelWidth:700,
    url: URL+'/filter_product/',
    idField:'id',
    textField:'name',
    mode:'remote',
    fitColumns:true,
    columns:[[
        {field:'id',title:'产品编号',width:40},
        {field:'tm',title:'条码',align:'left',width:80},
        {field:'name',title:'名称',align:'left',width:500},
        {field:'unit_id',title:'单位',align:'right',width:30}
    ]]
});

    jQuery('#common').combogrid({
    panelWidth:700,
    url: URL+'/filter_common_product/',
    idField:'id',
    textField:'name',
    mode:'remote',
    fitColumns:true,
    columns:[[
        {field:'id',title:'产品编号',width:40},
        {field:'name',title:'名称',align:'left',width:500},
        {field:'mano',title:'编码',align:'left',width:80},
        {field:'unit_id',title:'单位',align:'right',width:30}
        
    ]]
});

    function removerow(obj){
                    var objnum = jQuery(obj).parent().parent().parent().children().size();

                        jQuery(obj).parent().parent().remove();
                }

    function filter(trans_type){ 
        if (jQuery('#q').val() != "") {
            window.open(APP+'/Product/search/keywords/'+jQuery('#q').val()+'?form=form1&field=q&trtype='+trans_type,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
        }else
            window.open(APP+'/Product/search?form=form1&field=q&trtype='+trans_type,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
    }

    function filter_single(trans_type){ 
        if (jQuery('#q').val() != "") {
            window.open(APP+'/Product/search_single/keywords/'+jQuery('#q').val()+'?form=form1&field=q&trtype='+trans_type,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
        }else
            window.open(APP+'/Product/search_single?form=form1&field=q&trtype='+trans_type,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
    }

    function filterCommonProduct(trans_type){ 
        if (jQuery('#q').val() != "") {
            window.open(APP+'/Common_product/search/keywords/'+jQuery('#q').val()+'?form=form1&field=q&trtype='+trans_type,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
        }else
            window.open(APP+'/Common_product/search?form=form1&field=q&trtype='+trans_type,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
    }
                
    function showdetail(input_type,trans_type){
        var product_id = jQuery('input[name="'+input_type+'_id"]').attr('value');
        if(product_id > 0){
        jQuery.post(
        URL+'/getProductDetail',
        {   product_id:product_id,
            trans_type:trans_type
        },
        function(data){
            data = data.data;
            if(data.customer_id){
                jQuery('select[name="customer_id"]').empty();
                jQuery('select[name="customer_id"]').append(data.customer);
            }
                
            jQuery('#chosed_product').append(data.product_detail);
        },
        'json'
        );
        }
};


function showMassDetail(keyValue,trans_type){
        jQuery.post(
        URL+'/getMassPdetail',
        {   product_id:keyValue,
            trans_type:trans_type
        },
        function(data){
            data = data.data;
            if(data.customer_id){
                window.opener.jQuery('select[name="customer_id"]').empty();
                window.opener.jQuery('select[name="customer_id"]').append(data.customer);
            }
            jQuery("#chosed_product").append(data.product_detail);
        },
        'json'
        );

}
